package hn.cch.spring_boot_rest_quartz.result;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by chench on 4/18/20.
 */
public class QuartzMessage {

    private int code;
    private String info;

    private Map<String, Object> data = new HashMap<String, Object>();

    public static QuartzMessage success() {
        QuartzMessage message = new QuartzMessage();
        message.setCode(200);
        message.setInfo("success");
        return message;
    }

    public static QuartzMessage failed() {
        QuartzMessage message = new QuartzMessage();
        message.setCode(400);
        message.setInfo("failed");
        return message;
    }

    public QuartzMessage add(String key, Object value) {
        this.getData().put(key, value);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }
}
